package com.example.tijianserver.service;

import com.example.tijianserver.mapper.DoctorMapper;
import com.example.tijianserver.pojo.Doctor;
import com.example.tijianserver.response.TijianException;
import com.example.tijianserver.response.TijianExceptionEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DoctorServiceImpl implements DoctorService {
    @Autowired
    DoctorMapper doctorMapper;

    @Override
    public Doctor login(Doctor doctor){
        Doctor doctor1 = doctorMapper.selectBydocCode(doctor.getDocCode());

        if(doctor1!=null){
            return doctor1;
        }else {
            //不存在抛出异常
            throw new TijianException(TijianExceptionEnum.DOCTOR_IS_NOT_EXIST);
        }
    }
}
